package org.lai.controller;

import lombok.extern.slf4j.Slf4j;
import org.lai.pojo.ClazzsStudentCountOption;
import org.lai.pojo.Result;
import org.lai.pojo.jobOption;
import org.lai.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 统计员工职位人数
     */
    @GetMapping("/empJobData")
    public Result countEmpJobData(){
       log.info("统计员工职位人数");
       jobOption jobOption = reportService.getEmpJobData();
       return Result.success(jobOption);
    }
    /**
     * 统计员工性别人数
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别人数");
        List<Map<String ,Object>> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }
    /**
     * 统计班级人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("统计班级人数");
        ClazzsStudentCountOption studentCountList = reportService.getStudentCountData();
        return Result.success(studentCountList);
    }
    /**
     * 统计学员学历
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计学员学历");
        List<Map<String,Object>> data = reportService.getStudentDegreeData();
        return Result.success(data);
    }

}
